package webClient.UserInterfaceClasses;

import java.net.InetAddress;

import webClient.ChatEngine.RequestSender;
import webClient.UserInterfaceApplet.buddyList;

import communication.NewAccountRequest;
import communication.SignOnRequest;


public class Login
{	
	public static String user;
	public static String password;
	public static InetAddress ip;
	public static int port;
	
	public static boolean response = false;
	public static boolean success = false;
	
	public static void signOnRequest(SignOnRequest request) {
		//server validation goes here.
		user = request.getSender();
		password = request.getPassword();
		ip = request.getIP();
		port = request.getPort();
		
	}
	
	public static void validateUser(String username , String pass){
		
		RequestSender.serverSender.signOn(username, pass);
		
	}

	public static void createAccount(String username, String pass){
		
		NewAccountRequest nar = new NewAccountRequest(username, pass, buddyList.clientIP, buddyList.clientPort);
		RequestSender.serverSender.sendRequest(nar);
		
	}

}
